package PTA.javaA.ex19;


import java.util.Scanner;

abstract class Person{
    String name;
    int age;
    boolean gender;



    public  Person(String name, int age, boolean gender){
               this.name = name;
        this.age=age;
        this.gender=gender;

    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public int getAge() {
        return age;
    }

    public void setAge(int age) {
        this.age = age;
    }

    public boolean isGender() {
        return gender;
    }

    public void setGender(boolean gender) {
        this.gender = gender;
    }

    //返回"name-age-gender"格式的字符串
    @Override
    public String toString(){
         return name+"-"+age+"-"+gender;
    }
    //比较name、age、gender,都相同返回true,否则返回false
    @Override
    public boolean equals(Object obj){

        return false;
    }

}

class Student extends Person{
String stuNo;
String clazz;
    //建议使用super复用Person类的相关有参构造函数
    public Student(String name, int age, boolean gender, String stuNo, String clazz){
       super(name,age,gender);
       this.stuNo=stuNo;
       this.clazz=clazz;

    }
    //返回 “Student:person的toString-stuNo-clazz”格式的字符串
    @Override
    public String toString(){
        return super.toString() + "-" + stuNo + "-" + clazz;
    }
    //首先调用父类的equals方法,如果返回true，则继续比较stuNo与clazz。
    @Override
    public boolean equals(Object obj){

        return false;
    }


}

class Company{
    String name;
    public Company(String name){
        this.name=name;
    }
    public void setName(String name){
        this.name=name;

    }
    public String getName(){
        return name;
    }
    //直接返回name
    @Override
    public String toString(){
        return name;
    }
    // name相同返回true
    @Override
    public boolean equals(Object obj){
        return false;
    }

}
class Employee extends Person{
    Company company;
    double salary;
    //建议使用super复用Person类的相关有参构造函数
    public Employee(String name, int age, boolean gender, double salary, Company company){
        super(name,age,gender);
        this.salary=salary;
        this.company=company;
    }
    //返回"Employee:person的toString-company-salary"格式的字符串
    @Override
    public String toString(){
        return super.toString()+"-"+company+"-"+salary;
    }

    //首先调用父类的equals方法,如果返回true。再比较company与salary。
    // 比较salary属性时，使用DecimalFormat df = new DecimalFormat("#.#");保留1位小数
    @Override
    public boolean equals(Object obj){
        return false;
    }


}







public class ex19 {
    public static void main(String[] args) {
        Scanner sc  = new Scanner(System.in);

    }
}
